<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\AuctionWinner;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;

class AuctionWinnerController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new AuctionWinner(['user', 'product']), function (Grid $grid) {
            $grid->id->sortable();
            $grid->column('product.title', '商品名称');
            $grid->column('product.image', '商品图片')->image('','75');
            $grid->column('user.name', '获得者');
            $grid->column('product.price', '商品底价');
            $grid->column('product.ideal_price', '拍卖理想价格');
            $grid->price;
            $grid->created_at;
            $grid->updated_at->sortable();
            $grid->disableActions();
            $grid->disableCreateButton();
        
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
            });
        });
    }
}
